import {
    //
    createBrowserRouter,
    createHashRouter,
    RouterProvider as RouterProviderDom,
} from "react-router-dom"
import { PATHS, ROUTES } from "./routes"
import RouterRootLayout from "@/layouts/RouterRootLayout"
import ENV from "@/utils/env"

const createRouter = ENV.is_hash_router ? createHashRouter : createBrowserRouter

export function RouterProvider() {
    const router = createRouter([
        {
            path: PATHS.INDEX,
            element: <RouterRootLayout />,
            children: ROUTES,
        },
    ])
    return <RouterProviderDom router={router} />
}
